package com.cskaoyan.service.wx;

import com.cskaoyan.bean.MarketBrand;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.mapper.MarketBrandMapper;
import com.cskaoyan.mapper.MarketCategoryMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: zhang
 * @Date: 2022/11/22 20:27
 * @Since: jdk1.8
 */
@Service
public class WxBrandServiceImpl implements WxBrandService{
    @Autowired
    MarketBrandMapper marketBrandMapper;
    @Override
    public CommonData<MarketBrand> list(Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        List<MarketBrand> marketBrands = marketBrandMapper.selectAllBrands();
        PageInfo<MarketBrand> pageInfo = new PageInfo<>(marketBrands);
        return CommonData.data(pageInfo);
    }

    @Override
    public MarketBrand detail(Integer id) {
        return marketBrandMapper.selectByPrimaryKey(id);
    }
}
